# $Id: PKGBUILD 88685 2013-04-21 22:16:59Z heftig $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gnome-screensaver
pkgver=3.6.1
pkgrel=3
pkgdesc="Legacy GNOME screensaver"
arch=('i686' 'x86_64')
license=('GPL')
url="http://live.gnome.org/GnomeScreensaver"
backup=(etc/pam.d/gnome-screensaver)
depends=('dbus-glib' 'libgnomekbd' 'gnome-desktop')
makedepends=('intltool' 'gnome-common')
source=(http://ftp.gnome.org/pub/GNOME/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
       gnome-screensaver.pam
       move-desktop-file.patch
       fix-autoconf.patch)
sha256sums=('f39b78d4f7fed748c7f0a31d694112fb907c6d3c4e63db22eb858df07e962cd0'
            'b6ea9e2eb586d94bcabb617a8f1c2958111df87afdbb51f645882bccdc15cbda'
            '4bb96f62aa069c83b629204a79a3f63b146bcaf773569aee8b5dd23fbcd88974'
            'c4da9c18b543ecbc781c1f103321b324a855bdd0979fd36b437f6033736ad4bb')

build() {
  cd "$pkgname-$pkgver"

  # Upstream patch that moves gnome-screensaver desktop file out of autostart
  patch -Np1 -i "$srcdir/move-desktop-file.patch"

  # Fix build
  patch -Np1 -i "$srcdir/fix-autoconf.patch"

  autoreconf -fi
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib/$pkgname \
              --with-mit-ext
  make
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
  install -Dm644 ../gnome-screensaver.pam "$pkgdir/etc/pam.d/gnome-screensaver"
}
